//
//  NewsCell.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/21.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "NewsCell.h"
#import "UILabel+HWDUILabel.h"
@implementation NewsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setUpUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setUpUI
{
    //图片
    _producImageV = [[UIImageView alloc] init];
    _producImageV.image = [UIImage imageNamed:@"Main_hotel"];
    [self.contentView addSubview:_producImageV];
    [_producImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(20*screenW_6));
        make.top.equalTo(@(20*screenW_6));
        make.size.mas_equalTo(CGSizeMake(95* screenW_6,77 * screenW_6));
        make.bottom.equalTo(self.contentView).offset(-20*screenW_6);
    }];
    
    //名字
    _nameLab = [UILabel new];
    _nameLab.textColor = [UIColor colorWithHexString:@"333333"];
    _nameLab.font = [UIFont systemFontOfSize:17];
    _nameLab.textAlignment = NSTextAlignmentLeft;
    _nameLab.text = @" ";
    _nameLab.numberOfLines = 0;
    [self.contentView  addSubview:_nameLab];
    [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_producImageV.mas_right).offset(10*screenW_6);
        make.top.equalTo(_producImageV.mas_top);
        make.right.equalTo(self.contentView ).offset(-10*screenW_6);
    }];
    
    //描述 规格
    _describLab = [UILabel new];
    _describLab.textColor = [UIColor colorWithHexString:@"#777777"];
    _describLab.font = [UIFont systemFontOfSize:13.0];
    _describLab.textAlignment = NSTextAlignmentLeft;
    _describLab.text = @" ";
    _describLab.numberOfLines = 0;
    [self.contentView  addSubview:_describLab];
    [_describLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_producImageV.mas_right).offset(10*screenW_6);
        make.right.equalTo(self.contentView ).offset(-10*screenW_6);
        make.top.equalTo(_nameLab.mas_bottom).offset(15*screenW_6);
        make.height.equalTo(@(25*screenW_6));
        
    }];
}

-(void)setDataDic:(NSDictionary *)dataDic
{
    [_producImageV sd_setImageWithURL:[NSURL URLWithString:dataDic[@"image"]] placeholderImage:nil];
    _nameLab.text = dataDic[@"title"];
    _describLab.text = dataDic[@"createDate"];

}

@end
